﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using CalculateModelClasses;
using RayTracingModel;
using SetupFileObject;
using TerFileProceed;
using TxRxFileProceed;
using UanFileProceed;
using FileObject;
using RayTracingProceed;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //Point crosspoint = new Point(1, 0, 0.5);
            ////try
            ////{
            ////    List<RayInfo> d = Rays.TxRays(crosspoint);
            ////    for (int i = 0; i < d.Count; i++)
            ////        Console.WriteLine(d[i].RayVector.a + " " + d[i].RayVector.b + " " + d[i].RayVector.c + " " + k++);
            ////}
            ////catch (Exception e)
            ////{
            ////    Console.WriteLine(e.Message);
            ////}

            //Point linea = new Point(1,0,1);
            //Point lineb = new Point(1,0,0);
            //Point origin=new Point(0,0,0);
            //Point a=new Point(1,1,0);
            //Point b=new Point(2,0,0);
            //SpectVector line = new SpectVector(1,0,0.5);
            //RayInfo rayin = new RayInfo(origin, line);
            //RayInfo rayout=new RayInfo(crosspoint,new SpectVector(0.5,-1,0.5));
            //Face f0 = new Face(linea, lineb, a); Face f1 = new Face(linea, lineb, b);
            //List<Face> faces = new List<Face>();
            //faces.Add(f0); faces.Add(f1);
            ////Point a = Judge.isIntersect(Judge.Rf(path), LinePoint, LineVector, 0, 0);
            //try
            //{
            //    List<RayInfo> c = Rays.DiffractionRays(linea, lineb, crosspoint,rayin,faces, 90);
            //}
            //catch (Exception e)
            //{
            //    Console.Write(e.Message);
            //}
            //Point x = new Point(1, 0, 0);
            //Point y = new Point(0, 1, 0);
            //Point z = new Point(0, 0, 0);
            //Point m=new Point(0.5,0.5,0);
            //bool n =Intersection.IsInthetri(x,y,z,m);
            //Efield In = new Efield(new Plural(0,0),new Plural(1,0),new Plural(0,0));
            //List<double>F0=new List<double>();
            //List<double>Fn=new List<double>();
            //F0.Add(3);F0.Add(1);Fn.Add(3);Fn.Add(1);
            //Efield Diffract = DiffractEfiledCal.DiffractEField(In, rayin, rayout, 1, 1, faces, linea, lineb, 1000, F0, Fn);
            ////List<double> para=DiffractEfiledCal.GetPara(5,rayin,rayout,faces,linea,lineb);
            string path1 = @"E:\lpp\1.ter";
            string path3 = @"E:\lpp\test.setup";
            string path4 = @"E:\lpp\test.tx";
            string path5 = @"E:\lpp\test.rx";
            //FileInfo file = new FileInfo(path1);
            //string name = file.Name;
            //int pos = name.LastIndexOf('.');
            //name= name.Substring(0, pos);
            //StreamReader sr = new StreamReader(path1);
            //string ter = sr.ReadToEnd();
            //sr.Close();
            //sr = new StreamReader(path2);
            //string uan = sr.ReadToEnd();
            //List<Node> TXS=TxFileProceed.GetTx(path4, path3,path1);
            //Node root = new Node();
            //root.frequence = 1000; root.IsEnd = false; root.IsReceiver = false; root.LayNum = 1;
            //root.PointStyle = "Tx"; root.Position = new Point(1848.00000, 2044.00000, 2.00000);
            //root.Power = new Plural(10); root.TxNum = 1; root.NodeName = "asdf";
            //ReceiveBall rx = new ReceiveBall(new Point(2380.71360, 3213.79790, 2.00000), 1, "a", 100);
            //double dis = Intersection.Distance(rx.receiver, root.Position);
            //RayPath.GetTransPath(ter,  root, rx, 90);
            //List<CalculateModelClasses.Path> allpaths = RayPath.GetLegalPaths(root);
            RayTracingProceed.RayTracingProceed.Calculate(path3, path1, path4, path5);
            Console.ReadLine();
        }
    }
}
